package myJs.implicits

import myJs.myPkg.EasyPieChart
import org.scalajs.dom.Element
import org.scalajs.dom.raw.HTMLFormElement

import scala.scalajs.js

/**
 * Created by Administrator on 2020/1/16
 */
trait MyJsAnyTool {

  implicit class MyJsAny(any: js.Any) {

    def toJDS = {
      any.asInstanceOf[js.Dictionary[String]]
    }

    def toJDJAn = {
      any.asInstanceOf[js.Dictionary[js.Any]]
    }

    def toB = {
      any.asInstanceOf[Boolean]
    }

    def toJArJDS = {
      any.asInstanceOf[js.Array[js.Dictionary[String]]]
    }

    def toJArJDJAn = {
      any.asInstanceOf[js.Array[js.Dictionary[js.Any]]]
    }

    def toJArS = {
      any.asInstanceOf[js.Array[String]]
    }

    def toJArJDD = {
      any.asInstanceOf[js.Array[js.Dictionary[Double]]]
    }

    def toElement = {
      any.asInstanceOf[Element]
    }

    def toJsAny = {
      any.asInstanceOf[js.Any]
    }

    def toEasyPieChart = {
      any.asInstanceOf[EasyPieChart]
    }

    def toHTMLFormElement = {
      any.asInstanceOf[HTMLFormElement]
    }

    def isUndefined = {
      js.isUndefined(any)
    }

    def isDdefined = {
      !isUndefined
    }

  }

}
